package Ch01.Shangji;

import reflect.entity.Student;

import javax.print.attribute.standard.Media;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;

public class Shangji1 {
    public static void main(String[] args) {
        Class<Student> studentClass = Student.class;
        System.out.println("类名为: " +(studentClass.getSimpleName()));
        int modifier = studentClass.getModifiers(); //修饰符
        if (Modifier.isPublic(modifier))
            System.out.println("类的修饰符: public");
        System.out.println("继承的超类是: "+ studentClass.getSuperclass());   //超类

        Constructor[] constructors = studentClass.getDeclaredConstructors();
        for (Constructor c : constructors){
            System.out.println("构造方法:"+c);
            Field[] fields = studentClass.getDeclaredFields();
            for (Field field : fields){
                System.out.println("属性名称:" + studentClass.getName()+ "属性类型:"+field.getType());
            }
            for (Method method : studentClass.getDeclaredMethods()){
                System.out.println(studentClass.getSimpleName()+"类里面有方法: "+method.getName());
            }
        }
    }
}
